package cn.tedu;

import com.alibaba.druid.pool.DruidDataSource;

import java.sql.Connection;
import java.sql.SQLException;

public class DBUtils {
    private static DruidDataSource dds;

    static{
        dds = new DruidDataSource();

        dds.setUrl("jdbc:mysql://localhost:3307/empdb?characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false");
        dds.setUsername("root");
        dds.setPassword("3307");

        dds.setInitialSize(3);
        dds.setMaxActive(5);
    }

    public static Connection getConn() throws SQLException {

        Connection conn = dds.getConnection();

        return conn;
    }
}
